import React, {Fragment} from 'react'
import {AtIcon} from 'taro-ui'
import Taro from '@tarojs/taro'
import {View, Text, Image} from '@tarojs/components'

export default function DiscountList({discountList}) {

  function goToCommdetail(item) {
    Taro.navigateTo({
      url: '/pages/commdetail/index'
    })
  }

  return (
    <Fragment>
      {
        discountList.map((item, index) => {
          return (
            <View className='discount_li_item' key={index} onClick={() => {
              goToCommdetail(item)
            }}>
              <Image className='li_item_img' src={item.Image}/>
              <Text className='li_item_tit'>{item.text}</Text>
              <View className='li_item_tag'>
                <Text className='tag_one'>{item.tag}</Text>
              </View>
              <View className='li_item_price'>
                <Text className='li_new_price'>{item.newPrice}</Text>
                {/*<View className='comm_de_fr'>*/}
                {/*  <Text className={['reduce_comm_btn', item.showMoveTag ? 'move_tag' : 'no_move_tag']}>-</Text>*/}
                {/*  <Text className={item.showMoveTag ? 'move_tag' : 'no_move_tag'}>{item.commNum}</Text>*/}
                {/*  <Text className='add_comm_btn'>+</Text>*/}
                {/*</View>*/}
                <AtIcon value='shopping-cart' size='18' color='#3eaf56' />
              </View>
              <Text className='old_price'>{item.oldPrice}</Text>
            </View>
          )
        })
      }
    </Fragment>
  )
}
